package org.eclipseuseradmin.internal.ui.editors;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import org.eclipseuseradmin.ui.IRoleElement;

public class RoleElementInput implements IEditorInput {

	private IRoleElement roleElement;

	public RoleElementInput(IRoleElement roleElement) {
		this.roleElement = roleElement;
	}

	public boolean exists() {
		return true;
	}

	public ImageDescriptor getImageDescriptor() {
		return ImageDescriptor.getMissingImageDescriptor();
	}

	public String getName() {
		return "roleelement";
	}

	public IPersistableElement getPersistable() {
		return null;
	}

	public String getToolTipText() {
		return "tooltype";
	}

	public Object getAdapter(Class adapter) {
		return null;
	}

	public IRoleElement getRoleElement() {
		return roleElement;
	}

	@Override
	public boolean equals(Object obj) {

		if (obj == this) {
			return true;
		}

		if (obj == null || obj.getClass() != this.getClass()) {
			return false;
		}

		return (roleElement != null && roleElement
				.equals(((RoleElementInput) obj).roleElement));
	}

}
